Page({


  data: {
  search_city: '',
  imgsrc:100
  },

  getWeather(city) {
  let that = this

  wx.request({
   url: 'https://free-api.heweather.net/s6/weather/now"imgsrc": arr[i].cond_code,
     "tmp": arr[i].tmp,
     "time": arr[i].time.substring(11),
     "wind_dir": arr[i].wind_dir,
     "wind_sc": arr[i].wind_sc
     }
    }
    that.setData({
     hourly: hourly
    })
 
    var weekArray = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");

    wx.request({
     url: 'https://free-api.heweather.net/s6/weather/forecast"今天" : weekArray[new Date(arr[i].date).getDay()],
      d_date: arr[i].date.substring(5),
      imgsrc_d: arr[i].cond_code_d,
      imgsrc_n: arr[i].cond_code_n,
      wind_dir: arr[i].wind_dir,
      wind_sc: arr[i].wind_sc,
      tmp_max: arr[i].tmp_max,
      tmp_min: arr[i].tmp_min,
      cond_txt_d: arr[i].cond_txt_d
      }
     }
     that.setData({
      daily_forecast: daily_forecast
     })
     }
    })
    }
   }
   }
  })
  },
  bindKeyInput(e) {
  this.setData({
   search_city: e.detail.value
  })
  },
  search() {
  this.getWeather(this.data.search_city)
  },

  onLoad: function(options) {
  this.getWeather("北京")
  },
 })
 